package com.zyc.app.woa.activity;

import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.zyc.app.woa.R;
import com.zyc.app.woa.data.CachedArticle;
import com.zyc.app.woa.utils.Caches;
import com.zyc.app.woa.utils.Caches.CacheKey;

/**
 * Created by zyc on 12/27/14.
 */
public class OriginActivity extends BaseActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_browser);

        WebView webView = (WebView) findViewById(R.id.web_content);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });


        CachedArticle article = (CachedArticle) Caches.get(CacheKey.READING_ARTICLE);
        if (null != article) {
            webView.loadUrl(article.url);
        }
    }
}
